/*
 * GLBrowserJFrame.java
 *
 * Created on October 28, 2007, 7:34 PM
 */

package my.com.sunway.ui;

import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import my.com.sunway.event.HibernateEvent;
import my.com.sunway.listener.HibernateEventListener;

/**
 *
 * @author  lolo21
 */
public class GLBrowserJFrame extends JFrame implements HibernateEventListener {
    
    private DefaultTableModel tblmF0911 = null;
    /** Creates new form GLBrowserJFrame */
    public GLBrowserJFrame() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        pnlMain = new javax.swing.JPanel();
        btnNext = new javax.swing.JButton();
        btnPrev = new javax.swing.JButton();
        btnFind = new javax.swing.JButton();
        tfGLDate = new javax.swing.JTextField();
        lblGLDate = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblResult = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        pnlMain.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        btnNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/next.gif")));
        btnNext.setBorderPainted(false);
        btnNext.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/next_pressed.gif")));

        btnPrev.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/previous.gif")));
        btnPrev.setBorderPainted(false);
        btnPrev.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/images/previous_pressed.gif")));

        btnFind.setText("find");
        btnFind.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFindActionPerformed(evt);
            }
        });

        lblGLDate.setText("G/L Date:");

        org.jdesktop.layout.GroupLayout pnlMainLayout = new org.jdesktop.layout.GroupLayout(pnlMain);
        pnlMain.setLayout(pnlMainLayout);
        pnlMainLayout.setHorizontalGroup(
            pnlMainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlMainLayout.createSequentialGroup()
                .addContainerGap()
                .add(lblGLDate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(tfGLDate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 140, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnFind)
                .add(67, 67, 67)
                .add(btnPrev, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnNext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        pnlMainLayout.setVerticalGroup(
            pnlMainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(pnlMainLayout.createSequentialGroup()
                .add(pnlMainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btnNext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btnPrev, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btnFind)
                    .add(lblGLDate)
                    .add(tfGLDate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        tblResult.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tblResult);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
            .add(pnlMain, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(pnlMain, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnFindActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFindActionPerformed
// TODO add your handling code here:
        ResourceBundle bundle = ResourceBundle.getBundle("preliminary_settings", Locale.ENGLISH);
        String[] f0911_columnNames = bundle.getString("my.com.sunway.bean.F0911.keys").split("");
        tblmF0911 = new DefaultTableModel(f0911_columnNames, 0);
        tblmF0911.addRow(new Object[] {"Andreas", "Baumgartner"});
    }//GEN-LAST:event_btnFindActionPerformed

    public void dataRowFetched(HibernateEvent event) {
    }

    public void transactionCompleted(HibernateEvent event) {
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnFind;
    private javax.swing.JButton btnNext;
    private javax.swing.JButton btnPrev;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblGLDate;
    private javax.swing.JPanel pnlMain;
    private javax.swing.JTable tblResult;
    private javax.swing.JTextField tfGLDate;
    // End of variables declaration//GEN-END:variables
    
}
